#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
int main()
{
#if 0
	int n=6;

	if(fork())
	{
		while(1)
		{
			printf("父:%d\n",n++);
			sleep(1);
		}
	}
	else
	{
		while(1)
		{
			printf("子:%d\n",n+=2);
			sleep(1);
		}
	}


#else
	int* p = malloc(sizeof(int));
	*p = 6;
	if(fork())
	{
		while(1)
		{
			printf("%p\n",p);
			printf("父:%d\n",(*p)++);
			sleep(1);
		}
	}
	else
	{
		while(1)
		{
			printf("%p\n",p);
			printf("子:%d\n",(*p)+=2);
			sleep(1);
		}
	}
#endif


return 0;
}